home *** CD-ROM | disk | FTP | other *** search
/ Best of www.BestZips.com (Collector's Edition) / Best of WWW.BESTZIPS.COM Collector's Edition (JCSM Shareware) (JCS Marketing).ISO / pimslist / am_30r.zip / MACROS.TX_ < prev    next >
Text File  |  1994-03-02  |  4KB  |  133 lines

  1. The following three macros are Word For Windows macros
  2. that you can play with.  They illustrate how to use the
  3. new DDE protocol.  If you are not familiar with programming
  4. Word For Windows macros, its best not to try to get involved
  5. with this file.
  6.  
  7. ==============================================================
  8.  
  9. This is the SelectNameGetAddress macro.  It should be self
  10. explanatory if you run it.
  11.  
  12. Sub MAIN
  13.     On Error Goto Done
  14.  
  15.     ChanNum = DDEInitiate("address", "DDE.ADD")
  16.     NotDone = 1
  17.  
  18.     Dim NumNames$(5)
  19.     Dim ListName$(64)
  20.  
  21.     NumNames$ = DDERequest$(ChanNum, "c [Current List]")
  22.  
  23.     ListName$ = "List: " + DDERequest$(ChanNum, "l")
  24.  
  25.     Dim ListBox1$(Val(NumNames$))
  26.  
  27.     ListBox1$(0) = ""
  28.  
  29.     wItems = Val(NumNames$)
  30.  
  31.     ListBox1$(0) = DDERequest$(ChanNum, "uf [Current List] %NAME")   
  32.     ctr = 1
  33.     While ctr < wItems
  34.         ListBox1$(ctr) = DDERequest$(ChanNum, "un")
  35.         ctr = ctr + 1
  36.     Wend
  37.  
  38.     Begin Dialog UserDialog 420, 160, "Choose Name"
  39.     OKButton 320, 30, 88, 21
  40.     CancelButton 320, 59, 88, 21
  41.                 Text 20, 12, 380, 12, ListName$
  42.      ListBox 20, 30, 289, 124, ListBox1$(), .Index
  43.   End Dialog
  44.       
  45.    Dim TestDialog As UserDialog
  46.    Dialog TestDialog
  47.    If ListBox1$(TestDialog.Index) <> "" Then     Insert DDERequest$(ChanNum, "uf [Current List] " + \
  48.                                                             "[" + ListBox1$(TestDialog.Index) + "]" + \
  49.                                                             "%NAME%CR" + \
  50.                                                             "%A1%CR%A2%CR%A3%CR" + \
  51.                                                             "%CITY% %ST%, %ZIP%CR")
  52.  
  53. Done:
  54.    DDETerminate(ChanNum)
  55. End Sub
  56.  
  57. =========================================================================
  58.  
  59. This is a macro that gets all the names from a specified list.
  60.  
  61. Sub MAIN
  62.  
  63.     Dim Data$(500)
  64.  
  65.    ChanNum = DDEInitiate("address", "DDE.ADD")
  66.    Insert DDERequest$(ChanNum, "uf [All Addresses] [A Luther] %SAL% %FN" + \
  67.                                                             "% %LN%CR%A1" + \
  68.                                                             "% %A2%CR%A3%CITY% %ST%, %ZIP%CR" + \
  69.                                                             "%Home Phone: %HP%CR" + \
  70.                                                             "%Work Phone: %WP% %Ext. %WE%CR" + \
  71.                                                             "%Fax Phone: %FP%CR" + \
  72.                                                             "%His Birthday: %HISB%CR" + \
  73.                                                             "%Her Birthday: %HERB%CR" + \
  74.                                                             "%Anniversary: %AN%CR" + \
  75.                                                             "%Comment: %CMT%CR%CR")
  76.  
  77.  
  78.    NotDone = 1
  79.  
  80.    While NotDone
  81.       Data$ = DDERequest$(ChanNum, "un")
  82.       If Data$ = "" Then NotDone = 0 Else Insert Data$
  83.    Wend
  84.  
  85.    DDETerminate(ChanNum)
  86. End Sub
  87.  
  88. =========================================================================
  89.  
  90.  
  91. Sub MAIN
  92.  
  93. rem This macro is used with Address Manager to get the names of the
  94. rem User defined lists associated with the current file.  The lists are shown
  95. rem in a listbox.  See DDE.TXT for details on the DDE protocol.
  96.  
  97.     On Error Goto Done
  98.  
  99.     ChanNum = DDEInitiate("address", "MYNAMES2.ADD")
  100.     NotDone = 1
  101.  
  102.     Dim NumLists$(5)
  103.     Dim ListName$(64)
  104.  
  105.     NumLists$ = DDERequest$(ChanNum, "gcl")
  106.  
  107.     ListName$ = DDERequest$(ChanNum, "gfl")
  108.  
  109.     Dim ListBox1$(Val(NumLists$))
  110.  
  111.     ListBox1$(0) = ListName$
  112.  
  113.     ctr = 0
  114.     While ListBox1$(ctr) <> ""
  115.         ctr = ctr + 1
  116.         ListBox1$(ctr) = DDERequest$(ChanNum, "gnl")
  117.     Wend
  118.  
  119.     Begin Dialog UserDialog 420, 160, "Choose List"
  120.     OKButton 320, 30, 88, 21
  121.     CancelButton 320, 59, 88, 21
  122.                 Text 20, 12, 380, 12, "User Lists"
  123.      ListBox 20, 30, 289, 124, ListBox1$(), .Index
  124.   End Dialog
  125.       
  126.    Dim TestDialog As UserDialog
  127.    Dialog TestDialog
  128.  
  129. Done:
  130.    DDETerminate(ChanNum)
  131.  
  132. End Sub
  133.